package com.yx.springboot.service;

import com.yx.springboot.dao.IUserDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class UserService implements IUserService {
    //面向接口编程 降低耦合度 依赖spring注入
    @Autowired
    IUserDao userDao;
    //xml基于属性注入
//    public IUserDao getUserDao() {
//        return userDao;
//    }
//
//    public void setUserDao(IUserDao userDao) {
//        this.userDao = userDao;
//    }

    //耦合度过高
    //UserDao userDao=new UserDao();
    @Override
    public void getUser() {
        userDao.getUser();
    }
}
